package service.Impl;

import dao.UserDao;
import entity.User;
import service.UserService;

public class UserServiceImpl implements UserService {
    //只声明接口类型引用
    private UserDao dao;
    //无参构造
    public UserServiceImpl(){}
    //用于为dao属性赋值的构造方法
    public UserServiceImpl(UserDao dao) {
        this.dao = dao;
    }

    public void setDao(UserDao dao) {
        this.dao = dao;
    }

    /**
     * 保存用户信息
     * @param user
     */
    @Override
    public void save(User user) {
        //调用UserDao的方法保存用户信息
        dao.save(user);
    }
}
